package com.xuecheng.order.test;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Date;

@SpringBootTest
@RunWith(SpringRunner.class)
public class TaskDemo01 {
    //    记录日志
    private final static Logger LOGGER = LoggerFactory.getLogger(TaskDemo01.class);

    @Scheduled(cron = "0/3 * * * * *")//每隔三秒执行
    public void test01() {
        LOGGER.info("====================");
        System.out.println("程序1："+new Date());

        try {
            Thread.sleep(5000);
        } catch (Exception e) {
            e.printStackTrace();
        }
        LOGGER.info("====================");
    }
    @Test
    public void passwordEncoder(){
        BCryptPasswordEncoder encoder=new BCryptPasswordEncoder();
        String pass="123456";
//        $2a$10$9tkvUzLbMGi.NfL7c/5Xr.KZUrQo2Ti66WVKrHexqW8LBrqZlOgl2
//        $2a$10$6/q0DlsF3lfR6oVXviADu.PLfn5.M/y1RR.1735OlegX7XzlNiD4.
//        $2a$10$ThqC6Gbk.YswvbOg6UMzKe0GENxMJNps6OAWwhpzLJLBsg9IG4SBq
        String encode = encoder.encode(pass);
        System.out.println(encode);
    }
}
